10261 - Ferry loading (DP, programación dinámica) && 410 - Station balance (Dijkstra...
[and.git] / 11335 - Discrete pursuit / 11335.2.cpp
blob2635188c8bb3c43f8417444b00bbb6699f336b7b
1 #include <iostream>
3 using namespace std;
5 int main(){
6 unsigned int a,u,v;
7 while (cin >> a >> u >> v){
8 if (a == 0){
9 cout << "0" << endl;
10 }else{
11 unsigned int min, px, lx, py, ly, t;
12 px = 0;
13 lx = a;
14 t = 0;
15 while (px < lx){
16 ++t;
17 px += t;
18 lx += u;
20 min = t;
22 py = 1;
23 ly = v;
24 t = 1;
25 while (py < ly){
26 ++t;
27 py += t;
28 ly += v;
31 if (t > min) min = t;
32 cout << min << endl;
35 return 0;